﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace OnlineEducation.Data.Entities
{
    /// <summary>
    /// 课程系列
    /// </summary>
    /// <seealso cref="OnlineEducation.Data.Entities.EntityBase" />
    public class Course : EntityBase
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [Display(Name = "标题")]
        [Required(ErrorMessage = "标题不能为空")]
        [StringLength(100, ErrorMessage = "长度不能超过100")]
        public string Title { get; set; }

        [Display(Name = "附标题")]
        [StringLength(100, ErrorMessage = "长度不能超过100")]
        public string SubTitle { get; set; }

        [StringLength(500, ErrorMessage = "长度不能超过200")]
        [Display(Name = "课程描述")]
        public string Description { get; set; }

        [Display(Name = "科目")]
        [StringLength(100, ErrorMessage = "长度不能超过100")]
        [Required(ErrorMessage = "科目不能为空")]
        public string SubjectCode { get; set; }
        [NotMapped]
        public string Subject { get; set; }

        [NotMapped]
        public int PlanQty { get; set; }

        [Display(Name = "封面")]
        [StringLength(100, ErrorMessage = "长度不能超过100")]
        public string CoverPictureURL { get; set; }

        [Display(Name = "标签")]
        [StringLength(100, ErrorMessage = "长度不能超过100")]
        public string Tag { get; set; }

        [Display(Name = "价格")]
        
        public decimal Price { get; set; }

        
        [Display(Name = "状态")]
        public int Status { get; set; }//0，无效,1,有效

        [Display(Name = "是否是线上课程")]
        public bool isOnline { get; set; }

        [Display(Name = "最终考题")]
        public string FinalExamQuestion { get; set; }

        public List<Lesson> Lessons { get; set; }

        [ForeignKey("Teacher")]
        public int? TeacherId { get; set; }

        public ApplicationUser Teacher { get; set; }
    
    }
}



